from app.core.logger import logger
from app.services.xm_service import get_archive_goods

async def check_xm_price(archiveId: str, platformId: int):
    """
    检查XM藏品价格
    """
    res = await get_archive_goods(archiveId, platformId, page_size=1)
    if res["code"] != 200:
        logger.error(f"获取XM藏品价格失败, archiveId: {archiveId}, 错误信息: {res}")
        return
    data = res["data"]["goodsArchiveList"]
    if not data:
        logger.error(f"获取XM藏品价格失败, archiveId: {archiveId}, 错误信息: 无数据")
        return
    # 提取第一个藏品
    first_goods = data[0]
    price = first_goods["goodsPrice"]
    logger.info(f"XM藏品价格, archiveId: {archiveId}, 价格: {price}")
    return first_goods